package oop4.graph01;

import chap5.GetMax;

public class Painter {
    public static void main(String[] args) {
        Painter p = new Painter("画图软件CorelDraw 11");
        //三种绘制图像
        Circle c = new Circle(14);
        Rectangle s = new Rectangle(6, 13);
        //父类类型代指子类对象
        Graph sanjiao = new Triangle(3, 4, 5);
        p.calc(c);
        p.calc(s);
        p.calc(sanjiao);
    }

    private String name;

    public Painter(String name) {
        this.name = name;
    }

    public void calc(Graph graph) {
        double a = graph.calcArea();
        double z = graph.calcRound();
        System.out.println("工具:" + name + "开始绘制图像:");
        System.out.println(graph);
        System.out.println("这个图像的面积是:" + a + ",周长是:" + z+"\n");

    }
}
